[PATCH] Revert "QProcessEnvironment: simplify locking"
authorMiao Wang <shankerwangmiao@gmail.com>
Wed, 21 Jan 2026 17:30:17 +0000 (01:30 +0800)
committerPatrick Franz <deltaone@debian.org>
Sun, 9 Aug 2026 10:38:49 +0000 (12:38 +0200)
commit3205fd7dafac01f8b59b7888e9a082a24dc142bb
tree24ef6c332ad259517c63d839d658077a11377b4a
parent0d6271de4b02fd8ba111219d480d0dbda7279513
[PATCH] Revert "QProcessEnvironment: simplify locking"

This reverts commit c5d6b263c204cb09db2be36826e19acb03dc24fb.

The commit being reverted assumes the mutex is only protecting 'nameMap'
and nothing else is mutable, which is false. The mutex is not only
protecting 'nameMap' but also protecting the containing value objects,
since even though the value object is accessed read-only, its
implementation mutates its internal states for 2-way conversion between
ByteArray and QString.

Commit 85e61297f7b02297641826332dbdbc845a88c34b ("restore
QProcessEnvironment shared data thread safety on unix") said that
implicit sharing together with 'mutable' is a time bomb and the bomb is
triggered by the reverted commit.

Fixes: QTBUG-142938
Pick-to: 6.8
Change-Id: I9e3234f0eb2c691eccf753a11f63fae9944bd503
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 080d61c020678b75ed9d5acb062ec82ba8fc402f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 62917e4b518ecaa9dc34337e30f12eaeb41e790e)

Gbp-Pq: Name upstream_Revert-QProcessEnvironment-simplify-locking.patch
src/corelib/io/qprocess.cpp
src/corelib/io/qprocess_p.h
src/corelib/io/qprocess_unix.cpp